package com.lx.train.business.controller.admin;


import com.lx.train.common.resp.CommonResp;
import com.lx.train.common.resp.PageResp;
import com.lx.train.business.req.TrainSeatQueryReq;
import com.lx.train.business.req.TrainSeatSaveReq;
import com.lx.train.business.resp.TrainSeatQueryResp;
import com.lx.train.business.service.TrainSeatService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/admin/train-seat")
public class TrainSeatAdminController {
    @Autowired
    private TrainSeatService trainSeatService;


    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody TrainSeatSaveReq req) {
        trainSeatService.saveTrainSeat(req);
        return new CommonResp<>();
    }


     @GetMapping("/query-list")
     public CommonResp<PageResp<TrainSeatQueryResp>> queryList(@Valid TrainSeatQueryReq req) {
         PageResp<TrainSeatQueryResp> list = trainSeatService.queryList(req);
         return new CommonResp<>(list);
     }

     @DeleteMapping("/delete/{id}")
     public CommonResp<Object> delete(@PathVariable Long id) {
         trainSeatService.delete(id);
         return new CommonResp<>();
     }
}
